Multi-column multi-data type internationalized sort extension for web applications

ABSTRACT

A method for implementing a front-end user sort request includes receiving a list request, decomposing the list request and creating a sort entry object using a list of column values initially retrieved from a data storage medium. A sort routine is performed on at least a first column of the list of column values in the sort entry object, wherein a compare function of the sort routine is dependent upon information obtained from decomposing the list request. The list request is rebuilt in accordance with the completion of the sort routine.

CROSS REFERENCE TO RELATED APPLICATION

This application is a continuation application of U.S. Ser. No.10/856,392, filed May 28, 2004, the disclosures of which areincorporated by reference herein in their entirety.

BACKGROUND

The present invention relates generally to database sorting methods andsystems, and, more particularly, to a multi-column, multi-data typeinternationalized sort extension method for web applications.

Perhaps one of the most fundamental tasks to the operation of computersis sorting, which refers the process of arranging a set of similarinformation into a desired order. While employed in virtually alldatabase programs, sorting routines are also extensively used in manyother areas. Common examples include compilers, interpreters, andoperating system software. In many instances, the quality andperformance of such software is judged by the efficiency of its sortingtechniques. Since sorting methodology plays such an important role inthe operation of computers and other data processing systems, there hasbeen much interest in seeking ways to improve existing systems andmethods.

Historically, techniques for sorting information are divided into threegeneral methods: exchange, selection, and insertion. To sort byexchange, a system swaps or “exchanges” out of order information untilall data members are ordered. One well known example of exchange sortingis the “bubble sort,” which implements repeated comparisons andattendant exchanges of adjacent members. The efficiency of a bubble sortis dependent upon the number of possible comparisons (which increaseswith a greater number of elements to be sorted) and the number ofexchanges required by the sort (which increases the more the list to besorted is out of order). The end result is that the execution timeapproaches a multiple of the square of the number of elements, makingthe bubble sort unusable for large sorts.

With a selection sort, a system continually chooses or “selects” a datamember from one extreme of possible values (e.g., such as thelowest-value member) until all members have been selected. Because thesystem always selects the lowest-value member from those remaining, theset will be ordered from lowest to highest-value member when the processis completed. As is the case with a bubble sort, a selection sort isalso too slow for processing a large number of items.

In a sort by insertion, the system examines a data member and places orinserts that member into a new set of members, always inserting eachmember in its correct position. The sort is completed once the lastmember has been inserted. Unlike the other two sorting techniques, thenumber of comparisons that occur with this technique depends on theinitial order of the list. More particularly, the technique possesses“natural” behavior; that is, it works the least when the list is alreadysorted and vice versa, thus making it useful for lists which are almostin order. Also, the technique does not disturb the order of equal keys.If a list is sorted using two keys, the list will remain sorted for bothkeys after an insertion sort.

A particular concern for any sort method is its speed (i.e., how fast aparticular sort completes its task). The speed with which an array ofdata members can be sorted is directly related to the number ofcomparisons and the number of exchanges that must be made. Related tothe characteristic of speed is the notion of “best case” and “worstcase” scenarios. For instance, a sort may have good speed given anaverage set of data, yet unacceptable speed given highly disordereddata.

One technique for reducing the penalty incurred by exchanging fullrecords is to employ a method that operates indirectly on a file,typically using an array of indices, with rearrangement done afterwards.In this manner, any of the above sorting methods may be adapted so thatonly n “exchanges” of full records are performed. One particularapproach is to manipulate an index to the records, accessing theoriginal array only for comparisons. In other words, it is moreefficient to sort an index to the records than to incur the cost ofmoving large records around excessively.

Since all of the simple sorting techniques above execute in n² time,their usefulness for sorting files with a large number of records islimited. In other words, as the amount of data to be sorted increases,the execution speed of the technique becomes exponentially slower and,at some point, too slow to use. Thus, there has been great interest indeveloping improved techniques for sorting information. One of the bestknown improved sorting techniques is referred to as “quicksort,”invented in 1960. Quicksort's popularity is due in large part to itsease of implementation and general applicability to a variety ofsituations. Based on the notion of exchange sorting, it adds theadditional feature of “partitions.”

With quicksort, a value or “comparand” is selected for partitioning thearray into two parts. Those elements having a value greater than orequal to the partition value are stored on one side, while those havinga value less than the partition value are stored on the other side. Theprocess is repeated for each remaining part until the array is sorted,thus the process is essentially recursive. On the other hand, arecursive technique such as quicksort usually requires that asignificant amount of stack-based memory be reserved. Moreover, thistechnique, which is particularly sensitive to long common substrings,exhibits nonlinear behavior.

Notwithstanding the wide variety of sorting techniques available today,many existing web-based applications are dependent upon back-end systemsto perform the actual sorting operations. Although such sortingoperations may include sorting of multiple columns, sorting of multipledata types, and even sorting by national locale, there is currently noconvenient way of performing front-end, multi-column sorting, multi-datatype sorting and/or sorting based on user characteristics (i.e., bylocale).

SUMMARY

The foregoing discussed drawbacks and deficiencies of the prior art areovercome or alleviated by a method for implementing a front-end usersort request. In an exemplary embodiment, the method includes receivinga list request, decomposing the list request and creating a sort entryobject using a list of column values initially retrieved from a datastorage medium. A sort routine is performed on at least a first columnof the list of column values in the sort entry object, wherein a comparefunction of the sort routine is dependent upon information obtained fromdecomposing the list request. The list request is rebuilt in accordancewith the completion of the sort routine.

In another embodiment, a system for implementing a front-end user sortrequest includes a server configured for receiving a list request from afront-end device. The server further includes processing means fordecomposing the list request and creating a sort entry object using alist of column values initially retrieved from a data storage medium.The processing means is further configured for performing a sort routineon at least a first column of the list of column values in the sortentry object, wherein a compare function of the sort routine isdependent upon information obtained from decomposing the list request,and rebuilding the list request in accordance with the completion of thesort routine.

BRIEF DESCRIPTION OF THE DRAWINGS

Referring to the exemplary drawings wherein like elements are numberedalike in the several Figures:

FIG. 1 is a block diagram illustrating a method for performing aflexible front-end sort operation, in accordance with an embodiment ofthe invention;

FIG. 2 is an exemplary structure for the master sort entry object listdescribed in FIG. 1;

FIGS. 3( a) through 3(e) are data tables illustrating an exemplarymulti-column sort operation using the method of FIG. 1; and

FIG. 4 is a schematic diagram illustrating a computerized systemconfigured to provide a response to a user requested operation basedupon user characteristics.

DETAILED DESCRIPTION

Disclosed herein is a method and system for performing a flexiblefront-end multiple column and/or multiple data type sort without theneed for re-accessing the source database itself. Briefly stated, anapplication (such as a web application) is provided with a front-endfunction for supporting multi-column and/or multi-data type sorting thatdoes not rely on a database sort to satisfy user characteristics such asinternational collation. Thus, for example, an international userlocated in France may view a multiple column list retrieved from a U.S.database that is sorted according to the French code page, even if thedatabase itself provides sorted information according to the Englishcode page.

Referring initially to FIG. 1, there is shown a block diagram 100illustrating a method for performing a flexible front-end sortoperation, in accordance with an embodiment of the invention. Beginningat block 102, a list request is received (e.g., such as from a user orother front-end application). Instead of simply retrieving the requestedinformation from the applicable storage medium (e.g., database) usingwhatever sort methodology is provided by the storage medium, the methodfirst decomposes the list request, as indicated at block 104.

As is described in further detail hereinafter, based on the contents ofthe request (e.g., user characteristics, sort direction, data type list,etc.), a sort entry object is constructed from the storage medium data.In effect, the storage medium data is initially retrieved and “prepared”in a manner that allows for a flexible sorting of the data, depending onthe particulars of the request. Thus, as shown in block 106, the datafrom the constructed sort entry object is sorted. The sort routines usedfor this sort will depend on what the data types are, whether the datais from multiple columns, and whether the initial list request includesuser characteristics. Finally, once the sort is completed, the listrequest is rebuilt and returned to the requesting entity in therequested format, as shown in block 108.

Referring again to block 104 of FIG. 1, it will be seen that the requestmay include information such as user characteristics (e.g., languagecode, country code) as shown in block 110; a sort directions list (e.g.,ascending, descending) that may vary from column to column as shown inblock 112; and a data type list that may vary from column to column, asshown in block 114. Then, as shown in block 116, a list of eachrequested row is retrieved from the data storage medium and is used tobuild the sort entry object, as shown in block 118.

The construction of the sort entry object is a repetitive process thatis completed when such an object for each row in the “all rows” list iscomplete. Thus, for each row, a list of column values (including datatypes per row, if applicable) is created, as shown at block 120. Then,this row and column value list is stored in a sort entry object, asindicated at block 122. Assuming there are multiple rows, there will bea corresponding number of sort entry objects (with one or more columnvalues associated therewith). Accordingly, as a row and column valuelist is used to form a completed sort entry object, the completed sortentry object is itself stored in a master sort list, as indicated atblock 124. Once a sort entry object is completed for each row, theprocess exits and returns to block 104, signifying the decomposition ofthe user/front-end application request is complete. An exemplarystructure for the master sort list is illustrated in FIG. 2. As isshown, the master sort list 200 includes a separate sort entry object202 for each row 204 from the initial list request. In turn, each sortentry object 202 includes a list of column values 206 per row and, whereapplicable, the data types associated therewith.

Presented below is an exemplary XML request object for constructing asort object using the etcML framework of the CCT400 Presentation Layer:

public Sort createSort( ){ Sort sort = etcML.createSort( ); SortOrdersortOrder = etcML.createSortOrder( ); Value value = etcML.createValue(); value.setValue(“AuditTrail.id”);sortOrder.setOperator(SQLGroupByOperatorType.ASC);sortOrder.setValue(value); sort.getSortOrder( ).add(sortOrder); //*********************************** SortOrder sortOrder2 =etcML.createSortOrder( ); Value value2 = etcML.createValue( );value2.setValue(“AuditTrail.modifyDateTime”);sortOrder2.setOperator(SQLGroupByOperatorType.ASC);sortOrder2.setValue(value2); sort.getSortOrder( ).add(sortOrder2); //*********************************** SortOrder sortOrder3 =etcML.createSortOrder( ); Value value3 = etcML.createValue( );value3.setValue(“AuditTrail.columnName”);sortOrder3.setOperator(SQLGroupByOperatorType.DESC);sortOrder3.setValue(value3); sort.getSortOrder( ).add(sortOrder3);return sort; }

The first sort column entry will be considered the primary sort column.All other columns in the SortOrder object are considered secondary sortsto be used to break ties (i.e., compare matches) in the primary column.Secondary columns may not be used in all instances if there are no tiesto be broken.

Sample XML Request:

<?xml version=“1.0” encoding=“UTF-8”?> <esm:esmMLxmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance”xmlns:esm=“http://www.ibm.com/esm”xmlns:etcML=“http://www.ibm.com/v1/etcML” ID=“1”> <Transactions><Request xsi:type=“esm:ObjectRequestType” countryCode=“US”languageCode=“en” timeZone=“” esm:agentID=“EXAV” esm:userTrace=“false”><SystemID>eESM630</SystemID> <TransactionType>list</TransactionType><Parameters xsi:type=“esm:ParameterType”> <etcML:RequestedFields><RequestedField>AuditTrail.Agent.id</RequestedField><RequestedField>AuditTrail.columnName</RequestedField><RequestedField>AuditTrail.modifyDateTime</RequestedField></etcML:RequestedFields> <etcML:StartRow>1</etcML:StartRow><etcML:DisplayRowCount>0</etcML:DisplayRowCount> </Parameters><etcML:Filters operator=“AND”> <etcML:Filter key=“AuditTrail.Agent.id”operator=“Like”> <etcML:Value>B%</etcML:Value> </etcML:Filter></etcML:Filters> <etcML:Sort> <etcML:SortOrder operator=“Ascending”><etcML:Value>AuditTrail.columnName</etcML:Value> </etcML:SortOrder><etcML:SortOrder operator=“Ascending”><etcML:Value>AuditTrail.modifyDateTime</etcML:Value> </etcML:SortOrder><etcML:SortOrder operator=“Descending”><etcML:Value>AuditTrail.Agent.id</etcML:Value> </etcML:SortOrder></etcML:Sort> <esm:TransactionTarget>AuditTrail</esm:TransactionTarget></Request> </Transactions> </esm:esmML>

Referring once again to FIG. 1, the Sort List routine (block 106) isresponsible for the execution and accuracy of the multi-column sorting.In an exemplary embodiment, the underlying sort function is powered by aQuickSort algorithm. However, unlike a conventional QuickSort algorithm,the sort algorithm of the present method is written to handle anArrayList (master list) of SortEntry Objects (i.e., multi-columnsorting) as well the ability to use multiple Data Types.

The sort sequence begins with the ArrayList being sorted on the firstcolumn, as shown in block 126. Again, a data type indicator may bepresent, along with user characteristic information. If there is morethan one sort column, the ArrayList will enter a multi-column sequenceby beginning on the appropriate column index. The compare function ofthe support routine is dependent upon the data type indicator, any usercharacteristic information present and the index, as shown in block 128.A loop is then established from index 0 to the ArrayList size. The fullArrayList is sent to a function to find the first subset of duplicaterows found within the first column 1, as shown in block 130. Once thesubset has been identified, the next column of that first identifiedsubset will be used as the tiebreaker for the matching rows and will besorted accordingly. It is noted that if no subsets are found from thefirst column, then there is no need for further sorting beyond column 1and the sort process exits immediately, as reflected by decision block132.

On the other hand, if an identified subset is greater than 2 and thereexists more columns to sort, another sort loop is initiated to comparethe entries from the children's children sets. The children's sort loopis exited once the index of the last subset matches the length of thesort list (i.e., the outer main sort loop's size is reached), asreflected in decision block 134. Until such time, the sort routinecontinues to block 136 to sort the current subset according to any datatype indicator and user characteristic information available, andaccording to the current column index. As with the main sort routine ofthe first column, the subset sort routine compare operations areflexible, depending upon the data type indicator, any usercharacteristic information present, and the index, as shown in block138. Furthermore, the present method continues to look for subsetswithin subsets, as shown in block 140, and if further subsets arepresent (decision block 142), new indices are received (block 144), andthe sort subset routine is repeated. Otherwise, the routine returns tothe parent subset, as shown in block 146. Eventually, all subsets in themaster sort list are sorted and the entire sort subroutine is exited.The list request is then rebuilt as indicated previously and returned tothe requester in the manner requested.

FIGS. 3( a) through 3(e) illustrate an exemplary sort operation asdescribed above, wherein subsets within the master list data arediscovered and a multi-column sort is implemented. In the exampleillustrated, the data initially retrieved from/stored within the storagemedium (e.g., database, cache, etc.) is organized into three column, thefirst two columns sorted in ascending order, while the third column issorted in descending order. However, the new front-end request is forthe data in the first column to be presented in ascending order, withboth the second and third columns being sorted in descending order.

Data Stored in cache: New Request asks for: Col 1 - ASC Col 1 - ASC Col2 - ASC Col 2 - DSC Col 3 - DSC Col 3 - DSC

FIG. 3( a) summarizes the data as originally sorted/presented. Becausethe first column is already sorted in ascending order the initial sortwill result in no swapping of any row entries. The routine will thenproceed to look for a subset in column 1. As can be seen in FIG. 3( a),an immediate subset is discovered, since the first three rows all havethe data value “1” stored in column 1 thereof. Accordingly, a sortsubset routine is launched in which the first subset is further sortedby the values in column 2. Since column 2 is to be sorted in descendingorder, the compare function causes a swap between rows 3 and 1, asreflected in FIG. 3( b). Upon completion of the sorting of column 2 ofthe first column 1 subset, the routine will then look for another subsetwithin column 2. Because another subset is present (column 2, rows 2-3),still another sort subset routine is launched for column 3. Again, sincethe new request calls for column 3 to be sorted in descending order, itwill be seen that row 2 will need to be swapped with row 3. This swap isshown in FIG. 3( c).

Following the swap of rows 2 and 3, the routine recognizes that the endof the first sort subset routine is reached and will thus return tocolumn 1 to see if any further subsets are present beyond row 3. In theexample illustrated, there is in fact another subset in column 1, namelyrow 4 through row 6, wherein a data value of “2” is present for eachrow. Once again, a new subset sort operation commences for column 2,which ultimately results in a swap of rows 6 and 4. This swap is shownin FIG. 3( d). Furthermore, because there is now another subset incolumn 2 (rows 5 and 6), there is a subset sort operation of column 3.In this instance, however, the subset sort operation of column 3 willnot result a further row swap.

Finally, as shown in FIG. 3( e), the routine checks to see if there areany remaining subsets left in column 1, and finds another subset in rows7 and 8. The resulting subset sort of rows 7-8, column 2 does not resultin a row swap. There is, however a final subset in column 2, andtherefore a subset sort of column 3 takes place. The subset sort of rows7-8, column 3 also does not result in a row swap. Because the sort listlength has now been reached, the entire sort routine in this example isnow complete. Thereafter, the newly sorted ArrayList is used to build acomplete response object to send back the calling class. Theconstruction function first creates an empty ObjectResponseType andfills that with the RowSetType information of the original response.Information including startRow, fetchCount, displayRowCount, maxRowCountand totalCount may be loaded as is into the new response object.

As indicated previously, if the initial list request is accompanied byuser characteristic information, then the cache/database (multi-columnand or multiple data type information) sorting may be based on therequest's locale found in the xml header. Otherwise, if a locale is notprovided then the locale will default to English (enUS). An advantage tothe user characteristic information is that data originating from a U.S.location sorted by an English collation sequence may be resorted by thepresent method to suit the collation rules of another locale. Forexample, in the French alphabet, the accent marks associated with thecharacters can affect the sorting thereof.

The following list is sorted in accordance with an English collationsequence, as might be the case where the list is retrieved by a userfrom a U.S. based database or cache:

-   -   cote    -   coté    -   côte    -   côté

One the other hand, if the front-end user had requested that the recordsbe ordered in accordance with a French collation sequence, then theproper ordering would be:

-   -   cote    -   côte    -   coté    -   côtê

Because the collation sequence cannot be specified on a conventionaldatabase request, this is an undesirable limitation. Thus, through theuse of the user characteristic information in the list request, theconstructed sort entry object will include locale information that is inturn utilized by a modified compare function in the sort routine.

FIG. 4 is a schematic diagram illustrating a computerized system 400 inwhich the response to a user requested operation is based upon usercharacteristics (e.g., language code and country code). Moreparticularly, a user submits a list request through a computer device402 containing a browser 404 through a network 406 (e.g., internet). Aserver 408 (e.g., web server, application server, etc.) receives thelist request from the browser 404, along with user characteristics. Inthe example illustrated, the user characteristics include languagecode=es (Spanish) and country code=ES (Spain). The server 408 thenretrieves the requested data set from a storage entity such as database410 installed as US, English. Using the exemplary list request describedabove, the list 412 retrieved from the database 410 is sorted inaccordance with the English code. However, given that the usercharacteristics differ from the database locale/code, the retrieved listis resorted at the server level (according to the user characteristics)and a resorted list 414 then returned to the browser.

It should be appreciated that the application of system 400 is notlimited to specific sort requests per se, but is equally applicable toother user requests (e.g., queries) in which the outcome of the requestwill change depending upon the locale of the user. As such, thereconfiguration of requested data is not only transparent to the user,but is received in a more efficient manner by avoiding re-accessing thecorresponding data storage medium once the list is initially retrieved.

Finally, presented below is an example of a sample output using theabove described methodology for requested data having 35 sortablecolumns.

EXAMPLE

Sample Output from Sort Extension using 35 sortable columns

Digits indicate Row Numbers

While the invention has been described with reference to a preferredembodiment or embodiments, it will be understood by those skilled in theart that various changes may be made and equivalents may be substitutedfor elements thereof without departing from the scope of the invention.In addition, many modifications may be made to adapt a particularsituation or material to the teachings of the invention withoutdeparting from the essential scope thereof. Therefore, it is intendedthat the invention not be limited to the particular embodiment disclosedas the best mode contemplated for carrying out this invention, but thatthe invention will include all embodiments falling within the scope ofthe appended claims.

1. A system for implementing a front-end user sort request, comprising:a server configured for receiving an XML list request object from afront-end device; said server further including processing means for:decomposing said XML list request object in cache and repetitivelycreating a sort entry object in said cache for each row included in saidlist request using a list of column values initially retrieved from adata storage medium and prepared for use in a set of sort entry objectsin said cache, with each sort entry object including a row and one ormore column values associated with the row; creating a master sort entryobject list in said cache containing each of said created sort entryobjects, wherein the master sort entry object list includes a separatesort entry object for each row corresponding to said XML list requestobject; performing a sort routine on at least a first column of saidlist of column values in each of said sort entry objects, wherein acompare function of said sort routine is dependent upon informationobtained from said decomposing said XML list request object, said sortrouting further comprising: determining the existence of one or moreparent subsets within said first column of said list of column values ineach of said sort entry objects; and sorting each parent subset withinsaid first column using column values from a next most significantcolumn, wherein a compare function used for sorting said next mostsignificant column is based upon user characteristics included in saidsort entry objects, a sort directions list, and a data type list foreach of said number of columns corresponding to said XML list requestobject; and rebuilding said list request in accordance with thecompletion of said sort routine.
 2. The system of claim 1, wherein saidinformation obtained by said server from said decomposing said XML listrequest object further comprises at least one of: user characteristics,a sort directions list, and a data type list for each of a number ofcolumns corresponding to said list request.
 3. The system of claim 1,wherein said processing means for performing a sort routine furthercomprises: upon completion of sorting a given parent subset, determiningthe existence of one or more child subsets within said given parentsubset and sorting each determined child subset; and upon completion ofsorting of each of said determined child subsets, returning to thecolumn containing said given parent subset to determine whether anyfurther parent subsets are present.
 4. The system of claim 1, whereinsaid sort routine is based on a quicksort algorithm having a comparefunction thereof modified in accordance with said information obtainedfrom said decomposing said XML list request object.
 5. The system ofclaim 1, wherein: said server further comprises a web-based application;and said front-end device further comprises a web browser.
 6. A methodfor implementing a multi-column sort request, the method comprising:receiving an XML list request object from a front-end user; decomposingsaid XML list request object in cache to obtain a sort directions listfor each column corresponding to said list request; repetitivelycreating a sort entry object in said cache for each row corresponding tosaid XML list request object, each said sort entry object containing alist of column values initially retrieved from a data storage medium andprepared for use in a set of sort entry objects in said cache, with eachsort entry object including a row and one or more column valuesassociated with the row; creating a master sort entry object list insaid cache containing each of said created sort entry objects, whereinthe master sort entry object list includes a separate sort entry objectfor each row corresponding to said XML list request object; performing asort routine on at least a first column of said list of column values ineach of said sort entry objects, wherein a compare function of said sortroutine is dependent upon said sort directions list and a current columnindex, said sort routine further comprising: determining the existenceof one or more parent subsets within said first column of said list ofcolumn values in each of said sort entry objects; and sorting eachparent subset within said first column using column values from a nextmost significant column, wherein a compare function used for sortingsaid next most significant column is based upon user characteristicsincluded in said sort entry objects, a sort directions list, and a datatype list for each of said number of columns corresponding to said XMLlist request object; rebuilding said list request in accordance with thecompletion of said sort routine; and returning a rebuilt list request tosaid front-end user.
 7. The method of claim 6, further comprising: uponcompletion of sorting a given parent subset, determining the existenceof one or more child subsets within said given parent subset and sortingeach determined child subset; and upon completion of sorting of each ofsaid determined child subsets, returning to the column containing saidgiven parent subset to determine whether any further parent subsets arepresent.